package com.xayy.core.config.websocket;

import com.xayy.core.constant.ConfigCalPath;
import com.xayy.mgt.service.GenerateTheoryDataAsyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.net.URISyntaxException;


/**
 * @author plq
 */
@Component
@Slf4j
public class MsgRunner implements CommandLineRunner {

    public static WsClient client = null;
    private final GenerateTheoryDataAsyncService gg;
    private final ConfigCalPath configCalPath;

    public MsgRunner(GenerateTheoryDataAsyncService gg,ConfigCalPath configCalPath) {
        this.gg = gg;
        this.configCalPath = configCalPath;
    }

    @Override
    public void run(String... args) throws URISyntaxException {
//        Map<String, Object> adminToken = gg.getAdminToken();
//        if(adminToken!= null && adminToken.get("token") != null){
//            client = new WsClient(new URI(configCalPath.getWsUrl()+"/jeecg-boot/websocket/"+adminToken.get("userId")));
//            client.addHeader("Sec-Websocket-Protocol",adminToken.get("token").toString());
//            client.connect();//连接服务
//        }
    }
}

